package com.zhfi.dataapply.schedule.jobs;

import com.zhfi.dataapply.service.BatchService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
public abstract class AbstractGeneralJob implements Job {

    @Autowired
    private BatchService batchService;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        try {
            batchService.createBatchJob(getJobName() + "Job");
        } catch (Exception e) {
            log.error(getJobName() + "Job失败", e);
        }
    }

    protected abstract String getJobName();

}
